<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/restricted/template.xhtml">

        <ui:define name="title">MeteoCal - Notifications</ui:define>
        <ui:define name="titlePag">notifications</ui:define>
        <ui:define name="content">
            <ui:repeat var="notifi" value="#{personalPageBean.invitationsPending}" varStatus="status" 
                       rendered="#{not personalPageBean.invitationsPending.isEmpty()}">

                <div class="searchPar">
                    <div class="eventoForm">
                       
                        <h:form>  
                            <h:commandLink action="#{navigationBean.redirectToEventPage()}" > 
                                <f:setPropertyActionListener target="#{personalPageBean.eventSelected}" value="#{notifi}"/>
                                <div class="dateInfo2">
                                    <div style="padding:3px;"><h:outputText value="You are invited"/> 
                                        </div>
                                </div>
                                <div style="font-size: 15px">Event name: #{notifi.name}<br/>
                                    Event date: <h:outputText value="#{notifi.dateStart}">
                                        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Rome"/>            
                                    </h:outputText><br/>
                                    by: #{notifi.organizer.name} #{notifi.organizer.surname}
                                </div>
                            </h:commandLink>
                        
                        </h:form>

                    </div></div>
            </ui:repeat>
            
            <ui:repeat var="notif" value="#{personalPageBean.weatherNotifications}" varStatus="status" 
                       rendered="#{not personalPageBean.weatherNotifications.isEmpty()}">

                <div class="searchPar">
                    <div class="eventoForm">
                       
                        <h:form>  
                            <h:commandLink action="#{navigationBean.redirectToEventPage()}" > 
                                <f:setPropertyActionListener target="#{personalPageBean.eventSelected}" value="#{notif}"/>
                                <div class="dateInfo">
                                    <div style="padding:3px;"><h:outputText value="Bad weather forecast for your event"/> 
                                        </div>
                                </div>
                                <div style="font-size: 15px">Event name: #{notif.name}<br/>
                                    Event date: <h:outputText value="#{notif.dateStart}">
                                        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Rome"/>            
                                    </h:outputText><br/>
                                    Next sunny day*: <h:outputText value="#{notif.firstDate}">
                                        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Rome"/>            
                                    </h:outputText><br/>
                                    <h:outputText styleClass="environment2" value=" *if not found the date of today is shown" />
                                </div>
                            </h:commandLink>
                        
                        </h:form>

                    </div></div>
            </ui:repeat>
            


        </ui:define>

    </ui:composition>
</html>
